{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sigmoid函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sigmoid(t):\n",
    "    return 1 / (1 + np.exp(-t))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAH8RJREFUeJzt3Xt83HWd7/HXJ/dekl6T3i/UFmi5YyggKpVCLaiU9YFYVtcLal324OXselbUfbBe9pzj6jm7Z32IuhVZELmqKBWrLVQQFIGmFwptKA1t2qSXJG1C0zbNZWY+54+ZwhAmzaSZyW/ml/fz8Ugzv9/vOzOf/ObXd375zm++X3N3REQkXAqCLkBERDJP4S4iEkIKdxGREFK4i4iEkMJdRCSEFO4iIiGkcBcRCSGFu4hICCncRURCqCioJ544caLPnj07qKcXEclLGzZsOOjulf21CyzcZ8+eTU1NTVBPLyKSl8xsdzrt1C0jIhJCCncRkRBSuIuIhJDCXUQkhBTuIiIh1G+4m9mdZtZsZi/1sd3M7HtmVmdmW8zswsyXKSIiA5HOmftdwNKTbL8amJf4WgH8cPBliYjIYPR7nbu7P2Vms0/SZBnwU4/P1/esmY01synuvj9DNYpISMViTlckRmdPlM5IlEjU6YnGiMacnqgTicWIxJzIidtRT2yLt4nEnJg77uA4sRjxZcAT62Oeap0T8zeWHX+jXdLMo8nTkL5pfcp1b237pklMkxovnj+J82aMHezuO6l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4j/hv4+eQGidB4gvhk3RCfvLuvvwQG60rgZXdvTLXRzEaZWfmJ28TfVHwpVdtM6dXP+Vd9PF86E59nuq6lwJeBa929o482Q7W/cnLi90Sf/k+AWnf/tz7aTD7R929mC4n/Pz6U5brSeV1WAR9LXDVzCXD4RHfEEOjzr+cg9lcvycdRX1m0BlhiZuMS3ahLEutO3VC8g3wqX8RDqRHoApqANUnbvkb8SoftwNVJ61cDUxO35xAP/Trg50Bpluq8C/jbXuumAquT6ngh8bWVePdEtvfdPcCLwJbEgTWld12J5WuIX43x6hDVVUe8X3Fz4utHvesayv2V6ucHvkn8lw9AWeLYqUscS3OGYB+9k/if41uS9tM1wN+eOM6AWxL75gXib0y/YwjqSvm69KrLgNsT+/NFkq5yy3JtI4mH9ZikdYHsL+K/YPYDPYn8+hTx92nWATsS38cn2lYDdyTd96bEsVYHfHKwtegTqiIiIZSP3TIiItIPhbuISAgp3EVEQkjhLiISQgp3EZEQUriLiISQwl1EJIQU7iIiIfT/AfDvTn1iOeRyAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x2f385748400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(-10,10,500)\n",
    "y = sigmoid(x)\n",
    "\n",
    "plt.plot(x, y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### $\\hat p^{(i)} = \\sigma(X_b^{(i)}\\theta) = \\frac{1}{1+e^{-X_b^{(i)}\\theta}}$\n",
    "#### $J(\\theta)=-\\frac{1}{m}\\sum_{i=1}^{m}[y^{(i)}log(\\hat p^{(i)}) + (1-y^{(i)})log(1-\\hat p^{(i)})]$\n",
    "没有公式解, 只能使用梯度下降法求解"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 逻辑回归梯度下降法公式推导"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### ${\\sigma(t)}'= (1+e^{-t})^{-2}\\cdot e^{-t}$\n",
    "#### ${(log\\  \\sigma(t))}'=\\frac{1}{\\sigma(t)}\\cdot{\\sigma(t)}'=\\frac{1}{\\sigma(t)}\\cdot(1+e^{-t})^{-2}\\cdot e^{-t} = (1+e^{-t})^{-1}\\cdot e^{-t}=1-\\frac{1}{1+e^{-t}}=1-\\sigma(t)$\n",
    "### $\\frac{d(y^{(i)}log\\ \\sigma(X_b^{(i)}\\theta))}{d\\theta_j}=y^{(i)}(1-\\sigma(X_b^{(i)}\\theta))\\cdot X_j^{(i)}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### ${(log(1 - \\sigma(t)))}'=-\\frac{1}{1+e^{-t}}=-\\sigma(t)$\n",
    "### $\\frac{d\\ [\\ (1-y^{(i)})\\ \\cdot \\ log(1-\\sigma(X_b^{(i)}\\theta))\\ ]}{d\\theta_j}=(1-y^{(i)})\\cdot(-\\sigma(X_b^{(i)}\\theta))\\cdot X_j^{(i)}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---------------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### $\\frac{d\\ J(\\theta)}{d\\ \\theta_j}=\\frac{1}{m}\\sum_{i=1}^m (\\sigma(X_b^{(i)}\\theta)-y^{(i)})X_j^{(i)}=\\frac{1}{m}\\sum_{i=1}^m ({\\hat y}^{(i)} -y^{(i)})X_j^{(i)}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### $J(\\theta)=MSE(y, \\hat y)$  \n",
    "####    $\\nabla J(\\theta)=\\begin{pmatrix} \n",
    "    \\frac{\\partial J}{\\partial \\theta_0} \n",
    "    \\\\ \\frac{\\partial J}{\\partial \\theta_1}\n",
    "    \\\\ \\ldots\n",
    "    \\\\ \\frac{\\partial J}{\\partial \\theta_n}\n",
    "    \\end{pmatrix} = \\frac{2}{m} \n",
    "    \\begin{pmatrix}\\\\ \n",
    "    \\sum_{i=1}^{m}(X_b^{(i)}\\theta - y^{(i)})\n",
    "    \\\\ \\sum_{i=1}^{m}(X_b^{(i)}\\theta - y^{(i)}) X_1^{(i)}\n",
    "    \\\\ \\sum_{i=1}^{m}(X_b^{(i)}\\theta - y^{(i)}) X_2^{(i)}\n",
    "    \\\\ \\ldots\n",
    "    \\\\ \\sum_{i=1}^{m}(X_b^{(i)}\\theta - y^{(i)}) X_n^{(i)}\n",
    "    \\end{pmatrix}=\\frac{2}{m} \\cdot X_b^T \\cdot (X_b\\theta - y) \\tag{线性回归}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### $\\nabla J(\\theta)=\\begin{pmatrix} \n",
    "    \\frac{\\partial J}{\\partial \\theta_0} \n",
    "    \\\\ \\frac{\\partial J}{\\partial \\theta_1}\n",
    "    \\\\ \\ldots\n",
    "    \\\\ \\frac{\\partial J}{\\partial \\theta_n}\n",
    "    \\end{pmatrix} = \\frac{1}{m} \n",
    "    \\begin{pmatrix}\\\\ \n",
    "    \\sum_{i=1}^{m}(\\sigma(X_b^{(i)}\\theta) - y^{(i)})\n",
    "    \\\\ \\sum_{i=1}^{m}(\\sigma(X_b^{(i)}\\theta) - y^{(i)}) X_1^{(i)}\n",
    "    \\\\ \\sum_{i=1}^{m}(\\sigma(X_b^{(i)}\\theta)- y^{(i)}) X_2^{(i)}\n",
    "    \\\\ \\ldots\n",
    "    \\\\ \\sum_{i=1}^{m}(\\sigma(X_b^{(i)}\\theta) - y^{(i)}) X_n^{(i)}\n",
    "    \\end{pmatrix}=\\frac{1}{m} \\cdot X_b^T \\cdot (\\sigma(X_b\\theta) - y)\\tag{逻辑回归}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 使用自己封装的逻辑回归模型实现逻辑回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets\n",
    "\n",
    "iris = datasets.load_iris()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100, 2) (100,)\n"
     ]
    }
   ],
   "source": [
    "X = iris.data\n",
    "y = iris.target\n",
    "\n",
    "X = X[y<2, :2]  # y<2筛选出2类, :2留2个特征, 方便后面可视化\n",
    "y = y[y<2]\n",
    "print(X.shape, y.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAF1hJREFUeJzt3W+MXFd5x/Hv45kUMDREIqsSxX9WFYi2oBDiVQhNhUJsqhAs8wKqplpKg1q5eEMJLRV/GilVLSFUIVGgYKMlqEpqt4QGaANKaZsAhb4g1TokgWBaBWonTmizSUrS1G0q209f3Lt4d3Z25p6ZOTPnnPl9pKuduXN89zn3Xj++Pve5Z8zdERGRsmyadAAiIjJ6Su4iIgVSchcRKZCSu4hIgZTcRUQKpOQuIlIgJXcRkQIpuYuIFEjJXUSkQO2mDc2sBSwBj7j77o7PrgU+DDxSr/qEu9/Ua3vnn3++z87OBgUrIjLtjhw58ri7z/Rr1zi5A9cDR4FzN/j8Vnd/Z9ONzc7OsrS0FPDrRU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ISqiEiBpnJYRkSkdEruIiIFUnIXESmQkruISIGU3EVECqTkLiJSICV3EZECKbmLiBTo/wF71ENhAg0WoQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fd9ee8cfd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0,0], X[y==0,1], color='r')\n",
    "plt.scatter(X[y==1,0], X[y==1,1], color='b')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression()"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from c26_LogisticRegression import LogisticRegression\n",
    "\n",
    "log_reg = LogisticRegression()\n",
    "log_reg.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.93292947, 0.98717455, 0.15541379, 0.18370292, 0.03909442,\n",
       "       0.01972689, 0.05214631, 0.99683149, 0.98092348, 0.75469962,\n",
       "       0.0473811 , 0.00362352, 0.27122595, 0.03909442, 0.84902103,\n",
       "       0.80627393, 0.83574223, 0.33477608, 0.06921637, 0.21582553,\n",
       "       0.0240109 , 0.1836441 , 0.98092348, 0.98947619, 0.08342411])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.predict_prob(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,\n",
       "       1, 1, 0])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,\n",
       "       1, 1, 0])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 3.01749692, -5.03046934])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.6827383698993107"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.interception_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 决策边界\n",
    "### $\\hat p= \\sigma(\\theta^T \\cdot x_b) = \\frac{1}{1+e^{-\\theta^T\\cdot x_b}}$\n",
    "### $\\hat y = \\left \\{ \\begin{matrix}\n",
    "\\ \\ 1,\\ \\ \\  \\hat p >=0.5\\ ,\\ \\  \\ \\theta^T\\cdot x_b >= 0\\\\\n",
    "0,\\ \\ \\  \\hat p < 0.5 \\ ,\\ \\  \\ \\theta^T\\cdot x_b < 0\n",
    "\\end{matrix}\\right.$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 决策边界 : $\\theta^T\\cdot x_b = 0$\n",
    "如果有两个特征 $\\theta_0+\\theta_1 x_1+\\theta_2 x_2=0$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def x2(x1):\n",
    "    return (-log_reg.coef_[0] * x1 - log_reg.interception_)/log_reg.coef_[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl4VOX1wPHvy4QtsioISEjCjoiyRWQRjIAbIm1dWvzhAmqpUJe6VGqpWrG0at0XoNSVita6tRIWFQREBFmUNWEJSyAssoctZJvz+2MGjeMkM2Hmzr135nye5z7J3Ll37pnLcHLnfc+cMSKCUkqp+FLN7gCUUkpFnyZ3pZSKQ5rclVIqDmlyV0qpOKTJXSml4pAmd6WUikOa3JVSKg5pcldKqTikyV0ppeJQkl0HbtSokaSnp9t1eKWUcqXly5fvE5HGobazLbmnp6ezbNkyuw6vlFKuZIzJC2c7HZZRSqk4pMldKaXikCZ3pZSKQ5rclVIqDmlyV0qpOKTJXSml4pAmd6WUikOa3JVSKkaKSsuYOG8T32w7aPmxbPsQk1JKJQoR4bPs7xg/I4e8/ccZldmabqkNLT2mJnellLLQ+t1HGJe1loW5+2l7Zh2m3NKDfu1Cdg+ImCZ3pZSywMFjxTw7ewNvLc6jbq3q/PmqjgzrmUZ1T2xGwzW5K6VUFJWUeZm6OI9nZ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DgOyAzWJ+vsKJy47zFeB6Kh76iPk5Cycum87ZNqCnMSbZf+wB/DQXWJbD3FAt8yPGmHHAMhH5GN+k07+MMbn4/toNdUhcdxljhgCl/riGxyCEJsBH/tdvEvC2iMwyxtwOICKTgBnAICAXOA6McEhc1wKjjDGlQCEw1Oo/0n53AlP9b+c3AyMccL7Cicuu84UxJhm4BPhNuXW2n7Mw4or5ORORr40x7+MbEioFvgUmxyqH6SdUlVIqDjl2WEYppdSp0+SulFJxSJO7UkrFIU3uSikVhzS5K6VUHNLkrpRScUiTu1JKxSFN7kopFYf+H72XDQkn4fsxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fd9f3eeb70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 决策边界线\n",
    "x1_plot = np.linspace(4,8,1000)\n",
    "x2_plot = x2(x1_plot)\n",
    "plt.plot(x1_plot,x2_plot)\n",
    "\n",
    "# 数据点\n",
    "plt.scatter(X[y==0,0], X[y==0,1], color='r')\n",
    "plt.scatter(X[y==1,0], X[y==1,1], color='b')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100))\n",
    "    )\n",
    "    x_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "    \n",
    "    y_predict = model.predict(x_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A', '#FFF59D', '#90CAF9'])\n",
    "    plt.contourf(x0, x1, zz, linewidth=5, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHHFJREFUeJzt3X+s3XV9x/Hnm9vutqu37a7IaNpqY0CyjAkV0mm6KEO3KJJiAoYuOMC43LlMlOlChk1wIeEPt8T4g0VTZaxVp86iWyVohlGmsIkphVG003Qb0lsrBSr0Fi8dt33vj3PO5d5vz7nnc879fL/fz/f7fT2Shnu+59vvfZ8v7bvf+zmv7/uYuyMiIvV3RtkFiIhIMdTwRUQaQg1fRKQh1PBFRBpCDV9EpCHU8EVEGiK44ZvZiJk9bGZ3d3nuejN7ysweaf/6k7hliojIYi0ZYN8PAPuBlT2e/4q7v2/xJYmISB6CrvDNbB3wduBz+ZYjIiJ5Cb3C/zhwEzC2wD5XmtkbgZ8Cf+HuB7M7mNkEMAGwYnT0onPPPnvAckVEmu2Rn/3saXd/xTC/t2/DN7PLgSPu/pCZXdJjt28AX3L3E2b2XmAHcGl2J3ffDmwH2Lhhg39327ZhahYRaazfmJj42bC/N2RJZzOwxcweB74MXGpmX5i7g7s/4+4n2g8/C1w0bEEiIpKPvg3f3W9293XuvgHYCnzH3d81dx8zWzPn4RZab+6KiEhCBknpzGNmtwJ73H038H4z2wLMAEeB6+OUJyIisQzU8N39PuC+9te3zNl+M3BzzMJE8nbP1HI+dXSMX8yMcPaSk9wwPsVlY9NllyWSm6Gv8EWq7J6p5dz61Cpe8Naq5uGZJdz61CoANX2pLY1WkEb61NGx2Wbf8YKfwaeOLpQ8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/76qvY+SfwrG1J/Zs1vC603d5NgZivMbKzzNfCHQHZC6W7g2nZi4fXAc+5+uOBSTxNSuyU81sPdfwEcNLPOZMM3Az/O7JbkuYew+lM+/3P8Eb2XQ5I9/3P0rH+Y819USmceM7sV2OPuu2m9KfR5MztA68p+axk1DSJT//vNbAswQ6v+68usLeM3ga+3/0wsAf7R3b9lZu+F2dEY9wCXAQeAXwHvLqnWrJDahx3rUZQbgC+2fyz/H+DdFTn3Hf3qT/r8m9mvA38A/OmcbZU5/wH1D3z+NVpBRKQhdKetiEhDqOGLiDSEGr6ISEOo4YuINIQavohIQ6jhi4g0hBq+iEhD/D/2qRkKsbjjQwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fda0ef5358>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg, axis=[4,7.5,1.5,4.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## KNN 的 决策边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_jobs=1, n_neighbors=5, p=2,\n",
       "           weights='uniform')"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "\n",
    "knn_clf = KNeighborsClassifier()\n",
    "knn_clf.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHSpJREFUeJzt3X+MXeV95/H3lxnveOqMbQ0/imWbWhEJqkoAB2vayFVgQ3ZVHGQi4ShUbvmhRN5EDQlNI1RqyZGQ+INWSpOSVSIHlrWTbDaNSbsOcqKCEprANkTGEBziBLm7CR5ngsEO9pgOLmN/+8e9d7hz5s7c59557jnPuefzkkbMnHt87vce4OtnnvM5zzF3R0RE+t95RRcgIiL5UMMXEakINXwRkYpQwxcRqQg1fBGRilDDFxGpiOCGb2YDZvaMmT3S4rXbzOxlM3u2/vXhuGWKiMhiDXaw7yeAQ8DyeV7/urt/bPEliYhILwSN8M1sDfA+4IHeliMiIr0SOsL/LHAXMLLAPjeZ2buBF4A/d/cj2R3MbBuwDWDZ0NDVb7v44g7LFRGpOT58ftElFOLIzw684u4XdvNn2zZ8M7sBOObuT5vZtfPs9i3ga+5+xsw+AuwC3pPdyd13AjsB1q9b59/bvr2bmkWkolZuHeBzz/9J0WUU6s6xoV92+2dDRvgbgc1mtglYCiw3s6+4+8xZd/fjTft/Cbiv24JERLJmGv3zRVdSbm0bvrvfDdwNUB/hf6q52de3r3L3ifqPm6ld3BURWbRdV92qRh9JJymdWczsHmC/u+8FPm5mm4Fp4ARwW5zyRKSKNHXTGx01fHd/HHi8/v2Opu0zvwW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MN39bScVGd38ntV9f/8zM3p15PdnzT/vaDwC/4+5XAvcD/5h3gQsYBN4JfMHd1wOvAX+Z2Sflcx9Sf8rnH4D6VNRm4ButXm6xLZXzD7Stv+Pz3+sR/kZgs5n9AvjfwHvM7CuZfcaBtQBmNgisIJ3VOdvW7+7H3f1M/ccvAVfnW+LC3P1X9X8eozYHOJbZZeb8162htghe4drVnviyHuPAuLs/Vf95D7UGmt0nyXNPQP2Jn/+G64ED7v5Si9dSPv8N89bfzfnvacN397vdfY27r6P2a8l33f1PMrvtBW6tf7+lvk8Sf8uG1J+Z89tM7eJuEsxsmZmNNL4H/iuQXaF0L3BLPbHwB8BJd5/IudQ5Qmq3hJf1cPdfA0fMrLGy4XXATzO7JXnuIaz+lM9/kz9m/umQZM9/k3nr7+b855XSmcXM7gH2u/teaheFvmxmh6mN7G8uoqZOZOr/uJltBqap1X9bkbVl/DbwD/X/JgaB/+Xu3zGzj8DM0hj7gE3AYeDfgNsLqjUrpPZul/XIyx3AV+u/lv8/4PaSnPuGdvUnff7N7LeA/wL8t6ZtpTn/AfV3fP61tIKISEXoTlsRkYpQwxcRqQg1fBGRilDDFxGpCDV8EZGKUMMXEakINXwRkYr4D4Cfml6+d+t8AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fda12cab70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(knn_clf, axis=[4,7.5,1.5,4.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_jobs=1, n_neighbors=5, p=2,\n",
       "           weights='uniform')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf_all = KNeighborsClassifier()\n",
    "knn_clf_all.fit(iris.data[:, :2], iris.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3X+QHWW5J/DvM3NCMkwmGfkRJiRgcgtEIEqQVG4k6sqPtUyCJCWwsAVesLzGa1006N3rLsbiR0rWstxS5+perYC7RmFVCFyCJFiowIrJAjWBgAmDmmuA/JgkQEwyEyYhZ86zf5zTM2d6Ts/7ntO/3j79/VRNMae7T/dzmskz77z99NOiqiAioubXknYARESUDCZ8IqKcYMInIsoJJnwiopxgwiciygkmfCKinLBO+CLSKiIviMijNdbdJCJviMiWytffRxsmERGFVahj2xUAegFMCVj/C1W9OXxIREQUB6sRvojMBLAEwD3xhkNERHGxHeF/F8BXAHSMs81VIvIRAH8C8CVV3enfQESWA1gOAO0TJ150dldXneESUVhvtZ2cdggUws5Xnn9TVU9t5L3GhC8iVwDYr6qbReSjAZv9EsDPVPWYiPwDgDUALvVvpKqrAawGgAtnzdInV65sJGYiakDn9a3o3nZD2mFQSLfMn/hao++1mdJZCOBKEXkVwM8BXCoi91ZvoKpvqeqxysu7AVzUaEBEFA8mezImfFW9VVVnquosANcBeEJVR/3kiMj0qpdXonxxl4gcsWbujWmHQA6op0pnFBFZBaBHVR8B8EURuRJAEc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D+LSjcTbakiNKXwBwX+XP+78A+LSD59ImThfOJUTkRAD/EcDnqpY5dz4t4kz9fKrqsyKyFuXppSKAFwCsDps72VqBiCgneKctEVFOMOETEeUEEz4RUU4w4RMR5QQTPhFRTjDhExHlBBM+EVFO/H/6ekHK0u8anQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fda172b908>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(knn_clf_all, axis=[4,8,1.5,4.5])\n",
    "plt.scatter(iris.data[iris.target==0, 0], iris.data[iris.target==0, 1])\n",
    "plt.scatter(iris.data[iris.target==1, 0], iris.data[iris.target==1, 1])\n",
    "plt.scatter(iris.data[iris.target==2, 0], iris.data[iris.target==2, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_jobs=1, n_neighbors=50, p=2,\n",
       "           weights='uniform')"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf_all = KNeighborsClassifier(n_neighbors=50)\n",
    "knn_clf_all.fit(iris.data[:, :2], iris.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4y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VJ1FRPTZ2fN7PLgSLlOq9NoKRTgX+t/CwWgP/j7j81s8/A2KiLjcAyYAfwOvBXKa2z1ZEcUboO+H7lz/s/An+VwmMZps40HEvM7HjgPwJ/O25Z6o5niDoTP57u/riZraN8eakIPAWsbbd3arSCiEhO6J22IiI5oYYvIpITavgiIjmhhi8ikhNq+CIiOaGGLyKSE2r4IiI58f8BteI7q0HIGesAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fda16f3cc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(knn_clf_all, axis=[4,8,1.5,4.5])\n",
    "plt.scatter(iris.data[iris.target==0, 0], iris.data[iris.target==0, 1])\n",
    "plt.scatter(iris.data[iris.target==1, 0], iris.data[iris.target==1, 1])\n",
    "plt.scatter(iris.data[iris.target==2, 0], iris.data[iris.target==2, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
